﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using VO;
using Core;
namespace DAL
{
    public class loginDAL:ketnoi
    {

        public bool _User_them(VO.LoginVO data)
        {
            try
            {
                using (SqlCommand dbCmd = new SqlCommand("user_them", GetConnection()))
                {
                    dbCmd.CommandType = CommandType.StoredProcedure;
                    dbCmd.Parameters.Add(new SqlParameter("@ID", data.ID));
                    dbCmd.Parameters.Add(new SqlParameter("@Pwd", data.Pwd));
                    dbCmd.ExecuteNonQuery();
                }
            }
            catch
            {

            }

            return true;
        }
        public bool _User_xem(VO.LoginVO data)
        {
            using (SqlCommand dbCmd = new SqlCommand("user_xem", GetConnection()))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@ID", data.ID));
                dbCmd.Parameters.Add(new SqlParameter("@Pwd", data.Pwd));
                dbCmd.ExecuteNonQuery();
            }

            return true;
        }
        public bool _User_sua(VO.LoginVO data)
        {
            using (SqlCommand dbCmd = new SqlCommand("user_sua", GetConnection()))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@ID", data.ID));
                dbCmd.Parameters.Add(new SqlParameter("@Pwd", data.Pwd));
                dbCmd.ExecuteNonQuery();
            }

            return true;
        }
        public bool _User_xoa(string Id)
        {
            using (SqlCommand dbCmd = new SqlCommand("user_xoa", GetConnection()))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@ID", Id));
                dbCmd.ExecuteNonQuery();
            }

            return true;
        }
       
    }
}
